/**
 * Created by drfu on 16-4-26.
 */
var gulp = require('gulp');

//var entry = require("./js/entry");

var uglify = require('gulp-uglify');
var less = require('gulp-less');
var rename = require('gulp-rename');
var minicss = require('gulp-cssmin');
var watch = require('gulp-watch');
var concat = require('gulp-concat');
var amdOptimize = require('amd-optimize');
//var jshint = require('gulp-jshint');

//语法检查
//gulp.task('jshint', function () {
//    return gulp.src('./js/scripts/*.js')
//        .pipe(jshint())
//        .pipe(jshint.reporter('default'));
//});

gulp.task('minifycss', ['less'], function () {
    return gulp.src('./style/css/*.css')
        .pipe(minicss())
        .pipe(rename({suffix: ".min"}))
        .pipe(gulp.dest('./dist/style/css'));

});

gulp.task("less", function() {
    return gulp.src('./style/css/*.less')
        .pipe(less())
        .pipe(gulp.dest('./style/css'))
});


gulp.task("uglify", function () {
   gulp.src("./js/scripts/*.js")
       .pipe(uglify())
       .pipe(rename({suffix: ".min"}))
       .pipe(gulp.dest("./dist/js/scripts"));
});

//gulp.task("opt", function() {
//    return gulp.src('./js/scripts/*.js')
//        .pipe(amdOptimize('main'))
//        .pipe(concat('result.js'))
//        .pipe(gulp.dest('./js/scripts'));
//});


//gulp.task("dev", function() {
//    gulp.start("minifycss");
//});
gulp.task("release", function() {
    gulp.start(["minifycss", "uglify"]);
});